﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace IndyMosaic.Models.Web
{
    public class UserRepository
    {
        public static User GetUser()
        {
            return new User(Membership.GetUser(), UserProfile.CurrentUser, GetRolls(Membership.GetUser().UserName));
        }

        public static User GetUser(string userName)
        {
            return new User(Membership.GetUser(userName), UserProfile.Create(userName), GetRolls(userName));
        }

        public static User GetUser(Guid id)
        {
            return GetUser(Membership.GetUser(id).UserName);
        }

        private static string[] GetRolls(string userName)
        {
            return Roles.GetRolesForUser(userName);
        }
    }
}
